<?php

class ParamValue extends CActiveRecord
{
	/**
	 * The followings are the available columns in table 'param_value':
	 * @var integer $value_id
	 * @var integer $value_column
	 * @var integer $value_row
	 * @var string $value
	 * @var integer $parameter_id
	 */

	/**
	 * Returns the static model of the specified AR class.
	 * @return CActiveRecord the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'param_value';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		return array(
			array('value_column, value_row, value', 'required'),
			array('value_column, value_row', 'numerical', 'integerOnly'=>true)
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'parameter' => array(self::BELONGS_TO, 'ParamDesc', 'parameter_id')
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'value_id' => 'Value',
			'value_column' => 'Value Column',
			'value_row' => 'Value Row',
			'value' => 'Value',
			'parameter_id' => 'Parameter'
		);
	}

	private static $_db;

	public function getDbConnection() {
		return self::$_db;
	}

	public function setDbConnection($db) {
		self::$_db= $db;
	}

}
?>